%option noyywrap

%{
#include <stdio.h>

#define YY_DECL int yylex()

#include "calc.tab.h"

int line_num = 1;

%}

%%

[ \t]	; // ignore all whitespace
\n		{ ++line_num; return T_NEWLINE;}
[0-9]+		{yylval.ival = atoi(yytext); return T_NUMBER;}
[a-d] 	{yylval.cval = yytext[0]; return T_REG;}
"PUSH"	{return T_PUSH;}
"POP" 	{return T_POP;}
"ADD" 	{return T_ADD;}
"IFEQ" 	{return T_IFEQ;}
"JUMP"	{return T_JUMP;}
"PRINT"	{return T_PRINT;}
"DUP"	{return T_DUP;}

%%
